<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
          name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <meta name="csrf-token" content="cPqshWzq8AP6CPB3WnTjWi7etMHthoseg6rFAYVE">
    <title>销售单</title>
    <meta name="description" content="销售单"/>
    <meta name="Keywords" content="销售单"/>
    {include file="common/link" /}
</head>
<body class="body-1">
<div id="container">
    <div class="" id="content_area">
        <!--全部-->
        <!--全部-->
        <!--待付款-->
        <div id="item2" class="mui-slider-item mui-control-content class1 mui-active">
            <div class="" data-scroll="2">
                <div class="mui-scroll" data-pulltorefresh="7" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">
                    <div class="showdata">
                    {volist name="list" id="vo"}
                            <div>
                               <div class="order-item bgcolor-white mt10">
                                   <div class="order-item-t clearfix">
                                       <div class="home-link-box bgcolor-white clearfix">
                                           <div  class="fl">报表编号:<span style="font-size: 12px;color: rgba(104, 111, 140, 0.8);">{$vo.number}</span></div>
                                           <span class="fr color-red" >{$vo.explain}</span>
                                       </div>
                                   </div>
                                   <div class="order-item-c line-top  line-bot">
                                           <div class="txt box-flex-1">
                                               <h2 class="title" style="font-size: 15px;"></h2>
                                               <h2 class="title" style="line-height:25px;font-size: 15px;">{$vo.operator}-{$vo.name}</h2>
                                           </div>
                                   </div>
                                                                      <div class="order-item-b" style="height: 40px;">
                                                                              <a href="/web/stock/reportlist?report_id={$vo.id}">盘库</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                                                              <a href="/web/stock/reportlist?report_id={$vo.id}&is_stock=1">未盘库商品</a>
                                                                      </div>
<!--                                   <div class="order-item-b" style="height: 40px;">-->
<!--                                       <p class="f0" style="float: left">-->
<!--                                           <span>共<em>0</em>件</span>-->
<!--                                           <span>合计<em>¥0</em></span>-->
<!--                                       </p>-->
<!--                                   </div>-->
                               </div>
                            </div>
                    {/volist}
                    </div>
                    {if condition="empty($list)"}
                                        <div class="mui-pull-bottom-tips" style="margin-top: 50%">
                                            <div class="mui-pull-bottom-wrapper">
                                                <button class="mui-pull-loading addreport">创建新盘点</button>
                                            </div>
                                        </div>
                    {else /}

                    {/if}

                    <div class="weui-loadmore">
                        <i class="weui-loading"></i>
                        <span class="weui-loadmore__tips">正在加载</span>
                    </div>
                </div>

                <div class="mui-scrollbar mui-scrollbar-vertical">
                    <div class="mui-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 688px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">

                    </div>
                </div>
            </div>
        </div>

        <!--待付款-->

        <!--已完成-->
    </div>


    <select name="" id="srows" class="form-control" style="display: none">
        {volist name="srows" id="vo"}
        <option value="{$vo.id}">{$vo.name}</option>
        {/volist}
    </select>
    
    
    <!--左侧扇形导航-->
    {include file="common/left-nav" /}
    {include file="common/script" /}
    <!--左侧扇形导航-->
    </div>
<!--<script src="http://qm815204.b2c.qmai.cn/plugins/mui/js/mui.pullToRefresh.js"></script>-->
<!--<script src="http://qm815204.b2c.qmai.cn/plugins/mui/js/mui.pullToRefresh.material.js"></script>-->
<script>
    $('.addreport').click(function () {
        layer.open({
            title: '选择仓库'
            , btn: ['确定']
            , type:1
            , content: $('#srows'),
            yes: function (index,layero) {
                var storehouse_id = $('#srows').val();
                if(storehouse_id >0){
                    var url = "{$turl}"+'/web/stock/addreport'
                    $.post(url,{storehouse_id:storehouse_id},function (res) {
                        if(res.code == 1){
                            window.location.reload()
                        }else{

                        }
                    })
                }
            }})
    })
</script>
    <script>
        page = 1
        pagesize = 10
        status = 0;
        var loading = false;  //状态标记
        var total = "{$total}"
        if(total<pagesize){
            loading = true;
            // $('.weui-loadmore__tips').html('暂无数据')
            $('.weui-loadmore').hide()
        }
        $(document.body).infinite().on("infinite", function() {
            if (loading) return;
            loading = true;
            var total = "{$total}"
            if (total < pagesize) {
                loading = true;
                // $('.weui-loadmore__tips').html('暂无数据')
                $('.weui-loadmore').hide()
                return;
                false;
            }
            ajax()
        })
        $('#segmentedControl').on('click','a',function () {
            status = $(this).data('state')
            page = 0;
            $('.showdata').find('div').remove()
            // $(this).attr('class','mui-control-item  mui-active')
            ajax(1)
        })
        function ajax(type = 0) {
            var url = "{$turl}"+'/web/sales/getslips'
            $.post(url,{page:page,pagesize:pagesize,status:status,keywords:$('.keywords').val()},function (res) {
                loading = false;
                if(res.data.length >0){
                    page++;
                    var str = '';
                    for (var i=0;i<res.data.length;i++){
                        str+='<div>\n' +
                            '                               <div class="order-item bgcolor-white mt10">\n' +
                            '                                   <div class="order-item-t clearfix">\n' +
                            '                                       <div class="home-link-box bgcolor-white clearfix">\n' +
                            '                                           <a href="#" class="fl">订单编号:<span style="font-size: 12px;color: rgba(104, 111, 140, 0.8);">'+res.data[i]['number']+'</span></a>\n' +
                            '                                           <span class="fr color-red" >'+res.data[i]['status_txt']+'</span>\n' +
                            '                                       </div>\n' +
                            '                                   </div>\n' +
                            '                                   <div class="order-item-c line-top line-bot">\n' +
                            '                                       <a data-id="488" href="###" class="order-pro-item centerflex"><!---->\n' +
                            '                                           <div class="txt box-flex-1">\n' +
                            '                                               <h2 class="title" style="font-size: 15px;">'+res.data[i]['ccompany']+'</h2>\n' +
                            '                                               <h2 class="title" style="line-height:25px;font-size: 15px;">'+res.data[i]['operator']+'-'+res.data[i]['name']+'</h2>\n' +
                            '                                           </div>\n' +
                            '                                       </a>\n' +
                            '                                   </div>\n' +
                            '                                   <div class="order-item-b" style="height: 40px;">\n' +
                            '                                       <p class="f0" style="float: left">\n' +
                            '                                           <span>共<em>'+res.data[i]['sales_num']+'</em>件</span>\n' +
                            '                                           <span>合计<em>¥'+res.data[i]['actual_cost']+'</em></span>\n' +
                            '                                       </p>\n' +
                            '                                       <p class="f0" style="float: right">\n';

                        if(res.data[i]['status'] ==7 ){
                            str += ' <a  href="###" data-id="'+res.data[i]['id']+'" class="tag tag-grey change" >转正式单</a>';
                        }
                        if(res.data[i]['status'] ==1 ){
                            str += ' <a  href="###" data-id="'+res.data[i]['id']+'" class="tag tag-grey examine" >审核</a>';
                        }
                        if(res.data[i]['status'] == 1 || res.data[i]['status'] ==7 ){
                            str += '<a  href="/web/sales/edit?ids='+res.data[i]['id']+'" class="tag tag-grey cancle" >修改</a>';
                        }
                        str +='<a data-id="" href="/web/sales/detail?ids='+res.data[i]['id']+'"  class="tag tag-grey cancle">详情</a>';
                        // if(res.data[i]['status'] == 2 || res.data[i]['status'] ==3 ){
                        //     str +='<a  href="/web/sales/checkout?ids='+res.data[i]['id']+'"  class="tag tag-red pay">出库</a>';
                        // }
                        str +='                                           \n' +
                            '                                       </p>\n' +
                            '                                   </div>\n' +
                            '                               </div>\n' +
                            '                            </div>'
                    }
                    if(type == 1 && res.data.length <pagesize){
                        $('.weui-loading').hide()
                        $('.weui-loadmore__tips').hide()
                    }
                    $('.showdata').append(str)
                }else{
                    if(type == 1){
                        str = '<div class="mui-content " v-if="!items.length" style="height: 100%">\n' +
                            '                            <div class="shopping_null bgcolor-white" style="height: 100%;padding-bottom:100%;"> <i class="iconfont "></i>\n' +
                            '                                <p>暂无数据！</p>\n' +
                            '                        </div>'
                        $('.showdata').append(str)
                        loading = true;
                        $('.weui-loading').hide()
                        $('.weui-loadmore__tips').hide()
                    }else{
                        loading = true;
                        $('.weui-loadmore__tips').html('已经到底了')
                        $('.weui-loading').hide()
                    }

                    // $('.weui-loadmore_line').attr('style','display:block')
                }
            })
        }
    </script>

</body>
</html>
<!---带扇形 不带footer->
